home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / python.postinst < prev    next >
Encoding:
Text File  |  2012-05-04  |  3.6 KB  |  105 lines

  1. #! /bin/sh
  2. set -e
  3.  
  4. new_config_file()
  5. {
  6.     cat > /etc/python/debian_config <<-EOF
  7.     [DEFAULT]
  8.     # how to byte-compile (comma separated: standard, optimize)
  9.     byte-compile = standard
  10.     EOF
  11. }
  12.  
  13. case "$1" in
  14.     configure)
  15.     [ -d /etc/python ] || mkdir /etc/python
  16.     [ -f /etc/python/debian_config ] || new_config_file
  17.  
  18.     # run the rtinstall script, when 2.5 became a supported version
  19.         if [ -x /usr/bin/python2.5 ] && [ -n "$2" ] && dpkg --compare-versions $2 lt 2.4.4-3; then
  20.             if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  21.         echo "Linking and byte-compiling packages for runtime python2.6..."
  22.             fi
  23.             version=$(dpkg -s python2.5-minimal | awk '/^Version:/ {print $2}')
  24.             for hook in /usr/share/python/runtime.d/*.rtinstall; do
  25.         [ -x $hook ] || continue
  26.         $hook rtinstall python2.5 "$2" "$version"
  27.             done
  28.     fi
  29.  
  30.     # run the rtinstall script, when 2.6 became a supported version
  31.         if [ -x /usr/bin/python2.6 ] && [ -n "$2" ] && dpkg --compare-versions $2 lt 2.5.4-6; then
  32.             if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  33.         echo "Linking and byte-compiling packages for runtime python2.6..."
  34.             fi
  35.             version=$(dpkg -s python2.6-minimal | awk '/^Version:/ {print $2}')
  36.             for hook in /usr/share/python/runtime.d/*.rtinstall; do
  37.         [ -x $hook ] || continue
  38.         $hook rtinstall python2.6 "$2" "$version"
  39.             done
  40.     fi
  41.  
  42.         if [ -n "$2" ] && dpkg --compare-versions $2 lt 2.6.4-1~; then
  43.         oldv=$(echo $2 | sed 's/^\(...\).*/\1/')
  44.         if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  45.         echo "running python rtupdate hooks for python2.6..."
  46.         fi
  47.         for hook in /usr/share/python/runtime.d/*.rtupdate; do
  48.         [ -x $hook ] || continue
  49.         if ! $hook rtupdate python$oldv python2.6; then
  50.             hb=$(basename $hook .rtupdate)
  51.             echo >&2 "error running python rtupdate hook $hb"
  52.             errors=yes
  53.         fi
  54.         done
  55.         [ -z "$errors" ] || exit 4
  56.  
  57.         if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  58.         echo "running python post-rtupdate hooks for python2.6..."
  59.         fi
  60.         for hook in /usr/share/python/runtime.d/*.rtupdate; do
  61.         [ -x $hook ] || continue
  62.         if ! $hook post-rtupdate python$oldv python2.6; then
  63.             hb=$(basename $hook .rtupdate)
  64.             echo >&2 "error running python post-rtupdate hook $hb"
  65.             errors=yes
  66.         fi
  67.         done
  68.         [ -z "$errors" ] || exit 5
  69.         fi
  70.  
  71.     if [ -f /var/lib/python/python2.5_already_installed ] \
  72.        && [ ! -f /var/lib/python/python2.5_installed ]
  73.     then
  74.         if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  75.         echo "Linking and byte-compiling packages for runtime python2.5..."
  76.         fi
  77.         oldversion=$(cat /var/lib/python/python2.5_already_installed)
  78.         newversion=$(dpkg -s python2.5-minimal | awk '/^Version:/ {print $2}')
  79.         for hook in /usr/share/python/runtime.d/*.rtinstall; do
  80.         [ -x $hook ] || continue
  81.         $hook rtinstall python2.5 "$oldversion" "$newversion"
  82.         done
  83.     fi
  84.     rm -f /var/lib/python/python2.5_already_installed
  85.  
  86.     if [ -f /var/lib/python/python2.6_already_installed ] \
  87.        && [ ! -f /var/lib/python/python2.6_installed ]
  88.     then
  89.         if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
  90.         echo "Linking and byte-compiling packages for runtime python2.6..."
  91.         fi
  92.         oldversion=$(cat /var/lib/python/python2.6_already_installed)
  93.         newversion=$(dpkg -s python2.6-minimal | awk '/^Version:/ {print $2}')
  94.         for hook in /usr/share/python/runtime.d/*.rtinstall; do
  95.         [ -x $hook ] || continue
  96.         $hook rtinstall python2.6 "$oldversion" "$newversion"
  97.         done
  98.     fi
  99.     rm -f /var/lib/python/python2.6_already_installed
  100.  
  101.     rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null || true
  102. esac
  103.  
  104.  
  105.